﻿using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Xunit.Abstractions;
using Xunit.Sdk;

namespace LJ.Test.Host.Abstractions;


/// <summary>
/// 测试配置启动项
/// </summary>
/// <param name="messageSink"></param>
public abstract class HostTestFrameworkBase(IMessageSink messageSink) : XunitTestFramework(messageSink)
{
    /// <summary>
    /// 创建单元测试框架执行器
    /// </summary>
    /// <param name="assemblyName"></param>
    /// <returns></returns>
    protected override ITestFrameworkExecutor CreateExecutor(AssemblyName assemblyName)
    {
        var host = CreateHost();

        return new HostTestFrameworkExecutor(host, assemblyName, SourceInformationProvider, DiagnosticMessageSink);
    }

    public abstract IHost CreateHost();

}